package com.czy.fx.day1.stage;

import javafx.application.Application;
import javafx.stage.Stage;

public class demo2 extends Application {

    public static void main(String[] args) {
        launch(args);
    }

    @Override
    public void start(Stage primaryStage) throws Exception {
        //设置窗口透明度
        primaryStage.setOpacity(0.5);
        //设置窗口置顶
        primaryStage.setAlwaysOnTop(true);

        primaryStage.setWidth(500);
        primaryStage.setHeight(500);
        //设置x坐标点
        primaryStage.setX(20);
        //设置y坐标点
        primaryStage.setY(20);
        //监听x坐标变化
        primaryStage.xProperty().addListener((observable, oldValue, newValue) -> {
            System.out.println("x: " + newValue);
        });
        //监听y坐标变化
        primaryStage.yProperty().addListener((observable, oldValue, newValue) -> {
            System.out.println("y: " + newValue);
        });
        primaryStage.show();
    }
}